"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[42059],{42059:(e,t,n)=>{n.d(t,{AdminOnly:()=>ea,ClientPrefetchProvider:()=>ex,DevToolsBlockerGate:()=>ev,HeaderAdminLink:()=>ee,HeaderManhwaManagerLink:()=>en,HeaderNotification:()=>Z,HeaderSuperAdminGuard:()=>er,HeaderTestBoardLink:()=>et,HeaderUserArea:()=>Y,PointsGuideHost:()=>ep});var r=n(95155),a=n(12115);function i(e){return("string"==typeof e?BigInt(e):e).toLocaleString()}function s(e){var t;let{username:n,nickname:s,role:c,avatarUrl:o,points:u,level:d,curInLevel:m,needForLevel:h,ratio:f,remaining:p,isAdmin:x,compact:j=!1,nicknameEffect:v}=e,g=v?[v.rainbow?"nick-fx-rainbow":"",v.glow?"nick-fx-glow":"",v.bold?"nick-fx-bold":"",v.frame?"nick-fx-frame":""].filter(Boolean).join(" "):"",y=v?.color?{color:v.color}:void 0,[w,b]=(0,a.useState)(!1),[k,N]=(0,a.useState)(!1),[E,S]=(0,a.useState)(null),[L,_]=(0,a.useState)(o),P=(0,a.useRef)(null),C=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(!w)return;let e=e=>{P.current?.contains(e.target)||b(!1)},t=e=>{"Escape"===e.key&&b(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[w]);let M=async e=>{if(S(null),e.size>2097152)return void S("최대 2MB");N(!0);try{let t=new FormData;t.append("file",e);let n=await fetch("/api/me/avatar",{method:"POST",body:t}),r=await n.json().catch(()=>null);if(!n.ok||!r?.ok)return void S(r?.error||`업로드 실패 (${n.status})`);_(String(r.url))}catch(e){S(e instanceof Error?e.message:"업로드 실패")}finally{N(!1)}},A=async()=>{if(confirm("프로필 사진을 제거하시겠습니까?")){S(null),N(!0);try{let e=await fetch("/api/me/avatar",{method:"DELETE"});if(!e.ok)return void S(`제거 실패 (${e.status})`);_(null)}finally{N(!1)}}},D=s.charAt(0)||"?";return(0,r.jsxs)("div",{className:`usr-menu${j?" usr-menu--compact":""}`,ref:P,children:[(0,r.jsxs)("button",{type:"button",className:`usr-menu-trigger${j?" usr-menu-trigger--compact":""}`,onClick:()=>b(e=>!e),"aria-haspopup":"menu","aria-expanded":w,title:`Lv.${d} ${s}`,children:[(0,r.jsx)("span",{className:"usr-menu-avatar usr-menu-avatar--sm",children:L?(0,r.jsx)("img",{src:L,alt:""}):(0,r.jsx)("span",{className:"usr-menu-avatar-initial",children:D})}),!j&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"usr-menu-trigger-lv","data-tier":l(d,c),children:d}),(0,r.jsx)("span",{className:`usr-menu-trigger-name ${g}`,style:y,children:s}),(0,r.jsx)("svg",{className:"usr-menu-trigger-chevron",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,r.jsx)("polyline",{points:"6 9 12 15 18 9"})})]})]}),w&&(0,r.jsxs)("div",{className:"usr-menu-pop",role:"menu",children:[(0,r.jsxs)("div",{className:"usr-menu-head",children:[(0,r.jsx)("div",{className:"usr-menu-avatar usr-menu-avatar--md",onClick:()=>C.current?.click(),role:"button",title:"클릭하여 프로필 사진 등록 \xb7 최대 2MB \xb7 JPG/PNG/WebP/GIF",children:L?(0,r.jsx)("img",{src:L,alt:""}):(0,r.jsx)("span",{className:"usr-menu-avatar-initial",children:D})}),(0,r.jsxs)("div",{className:"usr-menu-head-meta",children:[(0,r.jsxs)("div",{className:"usr-menu-name",children:[(0,r.jsx)("span",{className:"usr-menu-name-lv","data-tier":l(d,c),children:d}),(0,r.jsx)("strong",{className:g,style:y,children:s}),"user"!==c&&(0,r.jsx)("span",{className:`usr-menu-role usr-menu-role--${c}`,children:"admin"===(t=c)?"관리자":"uploader"===t?"업로더":"banned"===t?"정지":t})]}),(0,r.jsxs)("div",{className:"usr-menu-uname",children:["@",n]})]}),(0,r.jsx)("input",{ref:C,type:"file",accept:"image/jpeg,image/png,image/webp,image/gif",hidden:!0,onChange:e=>{let t=e.target.files?.[0];t&&M(t),e.target.value=""}})]}),(0,r.jsxs)("div",{className:"usr-menu-hint",title:"프사 클릭 시 파일 선택 \xb7 자동으로 정사각 512px JPG로 변환",children:["\uD83D\uDCF7 ",(0,r.jsx)("strong",{children:"프로필 사진"}),"은 좌측 아바타 클릭으로 변경",(0,r.jsx)("br",{}),(0,r.jsx)("span",{style:{opacity:.85},children:"JPG \xb7 PNG \xb7 WebP \xb7 GIF / 최대 2MB"})]}),E&&(0,r.jsxs)("div",{className:"usr-menu-err",children:["⚠ ",E]}),k&&(0,r.jsx)("div",{className:"usr-menu-msg",children:"업로드 중..."}),(0,r.jsxs)("div",{className:"usr-menu-lvline",children:[(0,r.jsx)("div",{className:"usr-menu-progress",children:(0,r.jsx)("span",{style:{width:`${Math.round(100*f)}%`}})}),(0,r.jsxs)("div",{className:"usr-menu-lvline-bot",children:[(0,r.jsxs)("span",{children:[i(m)," / ",i(h)]}),(0,r.jsxs)("strong",{className:"usr-menu-pct",children:[Math.round(100*f),"%"]})]})]}),(0,r.jsxs)("button",{type:"button",className:"usr-menu-pt usr-menu-pt--btn",onClick:()=>{b(!1),window.dispatchEvent(new Event("open-points-modal"))},title:"포인트 내역 보기",children:[(0,r.jsxs)("span",{className:"usr-menu-pt-left",children:[(0,r.jsx)("span",{"aria-hidden":!0,children:"⭐"}),"포인트 ",(0,r.jsx)("strong",{children:i(u)})]}),(0,r.jsx)("span",{className:"usr-menu-pt-right",children:"내역 ›"})]}),(0,r.jsxs)("div",{className:"usr-menu-remain",children:["레벨업까지 ",(0,r.jsx)("strong",{children:i(p)})," 필요"]}),(0,r.jsxs)("div",{className:"usr-menu-list",children:[(0,r.jsxs)("a",{href:"/mypage",className:"usr-menu-item",children:[(0,r.jsx)("span",{children:"\uD83D\uDC64"}),"내 정보"]}),(0,r.jsxs)("a",{href:"/mypage?tab=posts",className:"usr-menu-item",children:[(0,r.jsx)("span",{children:"\uD83D\uDCC4"}),"내가 쓴 글"]}),(0,r.jsxs)("a",{href:"/my/works",className:"usr-menu-item",children:[(0,r.jsx)("span",{children:"\uD83D\uDCDA"}),"내 작품 관리"]}),(0,r.jsxs)("button",{type:"button",className:"usr-menu-item usr-menu-item--btn",onClick:()=>{b(!1),window.dispatchEvent(new Event("open-block-list"))},children:[(0,r.jsx)("span",{children:"\uD83D\uDEAB"}),"내 차단 리스트"]}),(0,r.jsxs)("button",{type:"button",className:"usr-menu-item usr-menu-item--btn",onClick:()=>{b(!1),window.dispatchEvent(new Event("open-points-guide"))},children:[(0,r.jsx)("span",{children:"⭐"}),"포인트 적립 안내"]}),L&&(0,r.jsxs)("button",{type:"button",className:"usr-menu-item usr-menu-item--btn",onClick:A,children:[(0,r.jsx)("span",{children:"\uD83D\uDDD1"}),"프로필 사진 제거"]}),x&&(0,r.jsxs)("a",{href:"/admin",className:"usr-menu-item",children:[(0,r.jsx)("span",{children:"⚙️"}),"관리자"]})]}),(0,r.jsx)("form",{action:"/api/auth/logout",method:"POST",className:"usr-menu-logout",children:(0,r.jsx)("button",{type:"submit",children:"↪ 로그아웃"})})]})]})}function l(e,t){return"admin"===t?"admin":e>=50?"legend":e>=25?"epic":e>=10?"rare":e>=3?"common":"novice"}var c=n(77238);let o="ntk:notifications:v1:",u=[{id:"comments",label:"댓글"},{id:"episodes",label:"북마크"},{id:"other",label:"기타"}],d=new Set(["post_comment","comment_reply","work_comment","work_comment_reply"]),m=new Set(["new_episode"]);function h(e){return d.has(e)?"comments":m.has(e)?"episodes":"other"}function f(e){return e.reduce((e,t)=>e+ +!t.readAt,0)}function p(e){return!!e&&"object"==typeof e&&"string"==typeof e.id&&"string"==typeof e.type&&"string"==typeof e.createdAt&&(null===e.title||"string"==typeof e.title)&&(null===e.excerpt||"string"==typeof e.excerpt)&&(null===e.href||"string"==typeof e.href)&&(null===e.readAt||"string"==typeof e.readAt)}function x(e){if(!e||"object"!=typeof e||!Array.isArray(e.items)||!e.items.every(p))return null;let t=Number(e.unread);return{items:e.items,unread:Number.isFinite(t)&&t>=0?Math.floor(t):f(e.items)}}function j(e){return`${o}${e}`}function v(e){try{sessionStorage.removeItem(j(e))}catch{}}function g(){C=null,M=null,A=6e4}function y(e){_!==e&&(_=e,P++,S=null,L=null,g())}function w(e){try{let t=sessionStorage.getItem(j(e));if(!t)return null;let n=JSON.parse(t);if("number"!=typeof n.fetchedAt||Date.now()-n.fetchedAt>3e4)return null;let r=x(n.data);if(!r)return v(e),null;return n.lastModified&&(C=n.lastModified),n.etag&&(M=n.etag),"number"==typeof n.pollMs&&(A=n.pollMs),{data:r,fetchedAt:n.fetchedAt}}catch{return null}}function b(e,t,n=Date.now()){try{sessionStorage.setItem(j(e),JSON.stringify({data:t,fetchedAt:n,lastModified:C,etag:M,pollMs:A}))}catch{}}function k(e,t){t?b(e,t.data,t.fetchedAt):v(e)}function N(e,t,n){y(e),P++;let r={items:t,unread:Math.max(0,Math.floor(n))};S={data:r,fetchedAt:Date.now()},b(e,r,S.fetchedAt)}function E(e,t=!1){e&&y(e),P++,S=null,L=null,t&&(g(),e&&v(e))}let S=null,L=null,_=null,P=0,C=null,M=null,A=6e4;async function D(e,t=!1){y(e);let n=Date.now();if(t&&E(e),!t&&S&&n-S.fetchedAt<5e3)return S.data;if(!t&&!S){let t=w(e);if(t)return S=t,t.data}if(!t&&L)return L;let r=P,a=fetch(t?"/api/notifications?limit=50&fresh=1":"/api/notifications?limit=50",{cache:"no-store",headers:function(e){if(e)return;let t={};return M&&(t["If-None-Match"]=M),C&&(t["If-Modified-Since"]=C),Object.keys(t).length?t:void 0}(t)}).then(async t=>{var n,r;let a,i;if(A=!Number.isFinite(r=Number((n=t.headers).get("X-Poll-Interval")))||r<=0?6e4:Math.min(3e5,Math.max(1e4,1e3*r)),(a=n.get("Last-Modified"))&&(C=a),(i=n.get("ETag"))&&(M=i),304===t.status){if(S)return S.fetchedAt=Date.now(),S.data;throw Error("HTTP 304 without notification cache")}if(!t.ok)throw 401===t.status&&(g(),E(e,!0)),Error(`HTTP ${t.status}`);let s=x(await t.json());if(!s)throw Error("Invalid notification payload");return s}).then(t=>(r===P&&(S={data:t,fetchedAt:Date.now()},b(e,t,S.fetchedAt)),t)).finally(()=>{L===a&&(L=null)});return L=a,a}function T(e){return"post_comment"===e?{emoji:"\uD83D\uDCAC",tone:"comment"}:"comment_reply"===e?{emoji:"↪",tone:"reply"}:"post_like"===e||"comment_like"===e||"work_comment_like"===e?{emoji:"\uD83D\uDC4D",tone:"like"}:"work_comment"===e?{emoji:"\uD83D\uDCAC",tone:"comment"}:"work_comment_reply"===e?{emoji:"↪",tone:"reply"}:"new_episode"===e?{emoji:"\uD83C\uDD95",tone:"episode"}:"subscribed_user_post"===e?{emoji:"\uD83D\uDCDD",tone:"episode"}:{emoji:"\uD83D\uDD14",tone:"etc"}}function $({enabled:e,ownerKey:t,initialUnreadCount:n=0,compact:i=!1}){let[s,l]=(0,a.useState)(!1),[o,d]=(0,a.useState)([]),[m,p]=(0,a.useState)(n),[x,j]=(0,a.useState)(!1),[v,g]=(0,a.useState)(null),[b,L]=(0,a.useState)([]),[_,C]=(0,a.useState)("comments"),[M,I]=(0,a.useState)(null),[R,O]=(0,a.useState)(!1),F=(0,a.useRef)(null),B=(0,a.useRef)(new Set),W=(0,a.useRef)(!1),H=(0,a.useRef)(!1),J=(0,a.useRef)(0),q=(0,a.useRef)(0),G=(0,a.useRef)(!1),U=(0,a.useRef)(!1),K=(0,a.useRef)(null),z=(0,a.useRef)(null),Q=(0,a.useRef)(!1),X=(0,a.useRef)(!1),V=(0,a.useRef)(n),Y=(0,a.useRef)(!1),Z=(0,a.useMemo)(()=>o.filter(e=>h(e.type)===_),[_,o]),ee=(0,a.useMemo)(()=>f(Z),[Z]),et=(0,a.useMemo)(()=>u.map(e=>{let t=o.filter(t=>h(t.type)===e.id);return{...e,total:t.length,unread:f(t)}}),[o]),en=(0,a.useCallback)(async(n=!1)=>{if(!e)return;if(G.current){U.current=!0;return}let r=++J.current,a=q.current;j(!0),g(null);try{let e=await D(t,n);if(r!==J.current||a!==q.current)return;let i=e.items;if(d(i),p(e.unread),W.current){let e=i.filter(e=>!B.current.has(e.id)&&!e.readAt);if(e.length){e.forEach(e=>{B.current.add(e.id)});let t=e.slice(0,3).map(e=>({...e,tid:Date.now()+Math.random()}));L(e=>[...t,...e].slice(0,3)),t.forEach(e=>{window.setTimeout(()=>{L(t=>t.filter(t=>t.tid!==e.tid))},5e3)})}}else{for(let e of i)B.current.add(e.id);W.current=!0}}catch(e){if(r!==J.current||a!==q.current)return;g(e instanceof Error?e.message:"알림 로드 실패")}finally{r===J.current&&j(!1)}},[e,t]),er=(0,a.useCallback)(()=>{if(E(t,!0),G.current){U.current=!0;return}K.current&&window.clearTimeout(K.current),K.current=window.setTimeout(()=>{if(K.current=null,"hidden"===document.visibilityState){U.current=!0;return}U.current=!1,en(!0)},200)},[en,t]);(0,a.useEffect)(()=>{if(H.current||!o.length||Z.length>0)return;let e=u.find(e=>o.some(t=>h(t.type)===e.id))?.id;e&&e!==_&&C(e)},[_,o,Z.length]),(0,a.useEffect)(()=>{Q.current=s},[s]),(0,a.useEffect)(()=>{X.current=R},[R]),(0,a.useEffect)(()=>{if(!e||"u"{!t&&(O(!0),z.current&&(window.clearTimeout(z.current),z.current=null))},a=e=>{if(e)try{let t=JSON.parse(e);"number"==typeof t.unread&&t.unread>=0&&p(t.unread)}catch{}},i=e=>{r(),a(e.data)},s=e=>{!t&&(a(e.data),Q.current&&er())};return n.onopen=r,n.onerror=()=>{t||O(!1)},n.addEventListener("ready",i),n.addEventListener("ping",r),n.addEventListener("invalidate",s),()=>{t=!0,n.removeEventListener("ready",i),n.removeEventListener("ping",r),n.removeEventListener("invalidate",s),n.close(),O(!1)}},[e,er]),(0,a.useEffect)(()=>{if(!e)return;let t=()=>{"hidden"===document.visibilityState||U.current&&!G.current&&(U.current=!1,en(!0))};return window.addEventListener("focus",t),document.addEventListener("visibilitychange",t),()=>{window.removeEventListener("focus",t),document.removeEventListener("visibilitychange",t)}},[e,en]),(0,a.useEffect)(()=>{V.current=n,!e||Q.current||G.current||p(n)},[e,n]),(0,a.useEffect)(()=>{if(J.current++,q.current++,G.current=!1,U.current=!1,K.current&&(window.clearTimeout(K.current),K.current=null),z.current&&(window.clearTimeout(z.current),z.current=null),l(!1),g(null),j(!1),I(null),L([]),C("comments"),Y.current=!1,H.current=!1,!e){d([]),p(0),O(!1),B.current.clear(),W.current=!1;return}y(t);let n=w(t);if(!n){d([]),p(V.current),B.current.clear(),W.current=!1;return}S=n,d(n.data.items),p(V.current),B.current=new Set(n.data.items.map(e=>e.id)),W.current=!0},[e,t]),(0,a.useEffect)(()=>{if(!e||!s)return;let t=!1,n=()=>{t||X.current||(z.current=window.setTimeout(r,A))},r=()=>{"hidden"===document.visibilityState?n():en(!1).finally(n)};if(R)Y.current||(Y.current=!0,en(!0));else{let e=!Y.current;Y.current=!0,en(e).finally(n)}let a=0,i=()=>{if("hidden"===document.visibilityState)return;let e=Date.now();e-a<5e3||(a=e,en(!1))};return window.addEventListener("focus",i),document.addEventListener("visibilitychange",i),()=>{t=!0,z.current&&(window.clearTimeout(z.current),z.current=null),window.removeEventListener("focus",i),document.removeEventListener("visibilitychange",i)}},[e,s,en,R]),(0,a.useEffect)(()=>()=>{K.current&&(window.clearTimeout(K.current),K.current=null)},[]),(0,a.useEffect)(()=>{if(!s){H.current=!1;return}let e=e=>{F.current&&!F.current.contains(e.target)&&l(!1)},t=e=>{"Escape"===e.key&&l(!1)};return document.addEventListener("click",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("click",e),document.removeEventListener("keydown",t)}},[s]);let ea=async()=>{if(0===ee||M)return;let e=S,n=++q.current;G.current=!0,U.current=!1,E(t);let r=new Date().toISOString(),a=o.map(e=>h(e.type)===_?{...e,readAt:e.readAt??r}:e);I("read"),g(null),d(a);let i=Math.max(0,m-ee);p(i),N(t,a,i);try{if(!(await fetch("/api/notifications",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"mark_all_read",category:_})})).ok)throw Error("mark_read_failed");G.current=!1,U.current=!1,q.current===n&&Q.current&&await en(!0)}catch{G.current=!1;let r=U.current;if(U.current=!1,q.current!==n)return;d(o),p(m),P++,S=e,k(t,e),g("알림 처리에 실패했습니다"),r&&er()}finally{q.current===n&&I(null)}},ei=async()=>{if(0===Z.length||M)return;let e=u.find(e=>e.id===_)?.label??"현재";if(!confirm(`${e} 알림을 삭제할까요?`))return;let n=S,r=++q.current;G.current=!0,U.current=!1,E(t);let a=o.filter(e=>h(e.type)!==_);I("clear"),g(null),d(a);let i=Math.max(0,m-ee);p(i),N(t,a,i);try{if(!(await fetch("/api/notifications",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear_all",category:_})})).ok)throw Error("clear_failed");G.current=!1,U.current=!1,q.current===r&&Q.current&&await en(!0)}catch{G.current=!1;let e=U.current;if(U.current=!1,q.current!==r)return;d(o),p(m),P++,S=n,k(t,n),g("알림 삭제에 실패했습니다"),e&&er()}finally{q.current===r&&I(null)}},es=e=>{if(!e.readAt){let n=S,r=++q.current;G.current=!0,U.current=!1,E(t);let a=new Date().toISOString(),i=o.map(t=>t.id===e.id?{...t,readAt:a}:t);d(i);let s=Math.max(0,m-1);p(s),N(t,i,s),fetch("/api/notifications",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"mark_read",ids:[e.id]})}).then(e=>{if(!e.ok)throw Error("mark_read_failed");G.current=!1,U.current=!1}).catch(()=>{G.current=!1;let e=U.current;U.current=!1,q.current===r&&(d(o),p(m),P++,S=n,k(t,n)),e&&er()})}l(!1)};if(!e)return null;let el=b.length>0&&(0,r.jsx)("div",{className:"notif-toast-stack","aria-live":"polite",children:b.map(e=>{var t;let n=T(e.type);return(0,r.jsxs)("div",{className:`notif-toast notif-toast--${n.tone}`,role:"status",children:[(0,r.jsx)("span",{className:"notif-toast-ico","aria-hidden":!0,children:n.emoji}),(0,r.jsxs)("div",{className:"notif-toast-body",children:[(0,r.jsxs)("div",{className:"notif-toast-head",children:[e.actor&&"new_episode"!==e.type&&(0,r.jsx)("strong",{children:e.actor.nickname}),(0,r.jsx)("span",{className:"notif-toast-type",children:"post_comment"===(t=e.type)?"님이 글에 댓글을 남겼습니다":"comment_reply"===t||"work_comment_reply"===t?"님이 답글을 남겼습니다":"post_like"===t?"님이 글을 추천했습니다":"comment_like"===t||"work_comment_like"===t?"님이 댓글을 추천했습니다":"work_comment"===t?"님이 작품에 댓글을 남겼습니다":"new_episode"===t?"북마크 작품에 신작이 등록되었습니다":"subscribed_user_post"===t?"님이 새 글을 작성했습니다":"알림"})]}),e.excerpt&&(0,r.jsxs)("div",{className:"notif-toast-text",children:['"',e.excerpt,'"']})]}),(0,r.jsx)("button",{type:"button",className:"notif-toast-x",onClick:()=>{var t;return t=e.tid,void L(e=>e.filter(e=>e.tid!==t))},"aria-label":"닫기",children:"✕"})]},e.tid)})});return(0,r.jsxs)("div",{className:`notif-widget ${i?"is-compact":""}`,ref:F,children:[el,(0,r.jsxs)("button",{type:"button",className:`notif-fab ${m>0?"has-unread":""}`,onClick:e=>{e.stopPropagation(),l(e=>!e)},"aria-label":`알림 (읽지 않음 ${m}개)`,title:m>0?`읽지 않은 알림 ${m}개`:"알림",children:[i?(0,r.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,focusable:"false",children:[(0,r.jsx)("title",{children:"알림"}),(0,r.jsx)("path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"}),(0,r.jsx)("path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0"})]}):(0,r.jsx)("span",{className:"notif-fab-ico","aria-hidden":!0,children:"\uD83D\uDD14"}),m>0&&(0,r.jsx)("span",{className:"notif-badge",children:m>99?"99+":m})]}),s&&(0,r.jsxs)("div",{className:"notif-modal",role:"dialog","aria-modal":"false","aria-label":"알림 목록",children:[(0,r.jsxs)("header",{className:"notif-modal-head",children:[(0,r.jsxs)("div",{className:"notif-head-title",children:[(0,r.jsx)("strong",{children:"알림"}),m>0&&(0,r.jsx)("span",{className:"notif-head-pill",title:`읽지 않음 ${m}개`,children:m>99?"99+":m})]}),(0,r.jsxs)("div",{className:"notif-head-actions",children:[(0,r.jsx)("button",{type:"button",className:"notif-act-link",onClick:ea,disabled:0===ee||null!==M,children:"모두 읽음"}),(0,r.jsx)("button",{type:"button",className:"notif-act-link notif-act-link--danger",onClick:ei,disabled:0===Z.length||null!==M,children:"삭제"}),(0,r.jsx)("button",{type:"button",className:"notif-modal-x",onClick:()=>l(!1),"aria-label":"닫기",children:(0,r.jsxs)("svg",{viewBox:"0 0 24 24",width:"13",height:"13",fill:"none",stroke:"currentColor",strokeWidth:2.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,focusable:"false",children:[(0,r.jsx)("title",{children:"닫기"}),(0,r.jsx)("path",{d:"M6 6l12 12M18 6L6 18"})]})})]})]}),(0,r.jsx)("div",{className:"notif-tabs",role:"tablist","aria-label":"알림 종류",children:et.map(e=>(0,r.jsxs)("button",{type:"button",role:"tab","aria-selected":_===e.id,className:`notif-tab ${_===e.id?"is-active":""}`,onClick:()=>{H.current=!0,C(e.id)},children:[(0,r.jsx)("span",{children:e.label}),(e.unread>0||e.total>0)&&(0,r.jsx)("em",{className:e.unread>0?"is-unread":"",children:e.unread>0?e.unread:e.total})]},e.id))}),(0,r.jsxs)("div",{className:"notif-modal-body",children:[x&&0===o.length&&(0,r.jsx)("div",{className:"notif-msg",children:"불러오는 중..."}),v&&(0,r.jsxs)("div",{className:"notif-err",children:["⚠ ",v]}),!x&&!v&&0===Z.length&&(0,r.jsxs)("div",{className:"notif-empty",children:[u.find(e=>e.id===_)?.label??"받은"," ","알림이 없습니다."]}),(0,r.jsx)("ul",{className:"notif-list",children:Z.map(e=>{var t,n;let a,i,s=T(e.type),l=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:`notif-item-dot notif-item-dot--${s.tone}`,"aria-hidden":!0}),(0,r.jsxs)("div",{className:"notif-item-main",children:[(0,r.jsxs)("div",{className:"notif-item-head",children:[(0,r.jsx)("span",{className:"notif-item-type",children:"post_comment"===(t=e.type)?"내 글에 댓글":"comment_reply"===t?"내 댓글에 답글":"post_like"===t?"내 글 추천":"comment_like"===t?"내 댓글 추천":"work_comment"===t?"내 작품에 댓글":"work_comment_reply"===t?"내 작품 댓글에 답글":"work_comment_like"===t?"내 작품 댓글 추천":"new_episode"===t?"북마크 작품 신작":"subscribed_user_post"===t?"구독한 작성자 새 글":"알림"}),(0,r.jsx)("time",{className:"notif-item-time",children:(a=new Date(n=e.createdAt).getTime(),(i=Date.now()-a)<6e4?"방금":i<36e5?`${Math.floor(i/6e4)}분 전`:i<864e5?`${Math.floor(i/36e5)}시간 전`:i<6048e5?`${Math.floor(i/864e5)}일 전`:new Date(n).toLocaleDateString("ko-KR",{month:"2-digit",day:"2-digit"}))})]}),(e.actor||e.title)&&(0,r.jsxs)("div",{className:"notif-item-line",children:[e.actor&&"new_episode"!==e.type&&(0,r.jsx)("strong",{children:e.actor.nickname}),e.actor&&"new_episode"!==e.type&&e.title&&(0,r.jsx)("span",{children:" \xb7 "}),e.title&&(0,r.jsx)("span",{children:e.title})]}),e.excerpt&&(0,r.jsx)("div",{className:"notif-item-excerpt",children:e.excerpt})]})]});return(0,r.jsx)("li",{className:`notif-item ${!e.readAt?"is-unread":""}`,children:e.href?(0,r.jsx)(c.D,{href:e.href,className:"notif-item-link",onClick:()=>es(e),prefetch:!1,children:l}):(0,r.jsx)("button",{type:"button",className:"notif-item-link",onClick:()=>es(e),children:l})},e.id)})})]})]})]})}let I=[{icon:"\uD83D\uDDD1",label:"내 글 삭제",amount:"-10P",detail:"글 작성으로 받은 +10P가 회수됩니다",cap:"한 글당 1회만 회수"},{icon:"✕",label:"내 댓글 삭제",amount:"-2P",detail:"댓글 작성으로 받은 +2P가 회수됩니다",cap:"한 댓글당 1회만 회수"},{icon:"\uD83D\uDCE4",label:"유료 소설 다운로드",amount:"-N P",detail:"공유 글에 설정된 다운로드 포인트(P)만큼 차감",cap:"동일 글 재다운로드는 무료"}],R=[{q:"추천을 받았는데 포인트가 안 들어와요",a:"추천은 1회당이 아니라 누적 10회마다 +20P 적립됩니다. 9회까지는 카운트만 쌓이고 10회째에 +20P가 한 번에 들어옵니다. ① 자기 추천/중복 추천(같은 기기\xb7IP+FP)은 카운트되지 않습니다. ② 하루 +20P 보너스는 10회(200P) 한도이며, KST 자정에 초기화됩니다(초과분은 적립되지 않음)."},{q:"한 작품에 댓글을 여러 개 달면 포인트도 여러 번 받나요?",a:"네. 작품 댓글은 매 댓글마다 +2P 적립됩니다. 회차마다 의견을 남기는 분들도 덤으로 포인트가 쌓입니다."},{q:"글이나 댓글을 삭제하면 받은 포인트는 어떻게 되나요?",a:"글 삭제 시 -10P, 댓글 삭제 시 -2P가 자동 회수됩니다. 한 글/댓글당 한 번만 회수됩니다."},{q:"관리자가 삭제해도 포인트가 차감되나요?",a:"네. 운영 정책 위반으로 관리자가 삭제한 경우에도 동일하게 회수됩니다."},{q:"포인트로 무엇을 할 수 있나요?",a:"레벨업, 유료 공유 소설 다운로드, 향후 상점 등에 사용됩니다."},{q:"포인트 내역은 어디서 확인하나요?",a:"헤더 닉네임 메뉴에서 '포인트' 항목을 클릭하면 입출 내역을 시간순으로 볼 수 있습니다."}];function O({novelPayoutPct:e=30}){let[t,n]=(0,a.useState)(!1),i=[{title:"\uD83D\uDCDD 글 / 댓글 활동",desc:"커뮤니티에 글을 쓰거나 댓글을 달면 포인트가 적립됩니다.",items:[{icon:"✏",label:"글 작성",amount:"+10P",detail:"자유/만화/유머/BL/소설 게시판 글 작성",cap:"글 1건당 1회 (건의/요청 게시판은 미지급)"},{icon:"\uD83D\uDCAC",label:"게시판 댓글",amount:"+2P",detail:"게시글에 댓글 또는 답글 작성",cap:"댓글 1건당 1회 (건의/요청 게시판은 미지급)"},{icon:"⭐",label:"작품 댓글",amount:"+2P",detail:"웹툰\xb7만화\xb7소설 작품에 댓글 작성",cap:"댓글 1건당 1회 (제한 없음)"}]},{title:"\uD83D\uDC4D 추천 활동",desc:"내 글\xb7댓글이 다른 회원에게 추천(좋아요) 받으면 누적 카운트가 쌓이고, 10회마다 보너스가 들어옵니다.",items:[{icon:"\uD83C\uDFC6",label:"추천 10회 달성",amount:"+20P",detail:"내 글/댓글에 다른 회원이 좋아요를 누른 횟수가 누적 10회마다 +20P 자동 적립",cap:"글+댓글 합산 카운트 / 자기 추천\xb7중복 추천 제외"},{icon:"↩",label:"추천 취소 처리",amount:"—",detail:"추천한 사람이 취소하면 누적 카운트에서 1 차감 (이미 받은 +20P 보너스는 회수되지 않음)",cap:"— "},{icon:"\uD83D\uDCCA",label:"1일 적립 한도",amount:"최대 200P",detail:"+20P 보너스는 하루 10회까지만 적립되며, KST 자정에 초기화됩니다",cap:"한도 초과분은 적립되지 않습니다"}]},{title:"\uD83D\uDC30 친구 초대",desc:"내 추천 링크로 새 친구가 방문할 때마다 보상.",items:[{icon:"\uD83D\uDD17",label:"추천 링크 방문",amount:"+1P",detail:"내 링크로 누군가 사이트에 방문할 때 자동 적립",cap:"방문자 IP 기준 1일 1회"}]},{title:"\uD83D\uDC8E 기타 활동",desc:"특정 행동으로 추가 포인트가 들어옵니다.",items:[{icon:"\uD83D\uDCE5",label:"소설 다운로드 적립",amount:`+${e}%`,detail:`내가 올린 공유 소설을 다른 회원이 다운로드하면 차감 포인트의 ${e}%를 작성자에게 자동 지급`,cap:"다운로드 1건당 1회"},{icon:"\uD83C\uDF81",label:"관리자 지급",amount:"별도",detail:"이벤트 보상, 운영진 지급 등 수동 지급 항목"}]}];return((0,a.useEffect)(()=>{let e=()=>n(!0);return window.addEventListener("open-points-guide",e),()=>window.removeEventListener("open-points-guide",e)},[]),(0,a.useEffect)(()=>{if(!t)return;let e=e=>{"Escape"===e.key&&n(!1)};return document.addEventListener("keydown",e),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",e),document.body.style.overflow=""}},[t]),t)?(0,r.jsx)("div",{className:"pgm-overlay",onClick:()=>n(!1),role:"dialog","aria-modal":"true","aria-label":"포인트 적립 안내",children:(0,r.jsxs)("div",{className:"pgm-modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("header",{className:"pgm-head",children:[(0,r.jsxs)("div",{className:"pgm-head-title",children:[(0,r.jsx)("span",{"aria-hidden":!0,children:"⭐"}),(0,r.jsx)("strong",{children:"포인트 적립 안내"})]}),(0,r.jsx)("button",{type:"button",className:"pgm-x",onClick:()=>n(!1),"aria-label":"닫기",children:(0,r.jsx)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:2.6,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,r.jsx)("path",{d:"M6 6l12 12M18 6L6 18"})})})]}),(0,r.jsxs)("div",{className:"pgm-body",children:[i.map((e,t)=>(0,r.jsxs)("section",{className:"pgm-section",children:[(0,r.jsxs)("div",{className:"pgm-section-head",children:[(0,r.jsx)("h3",{children:e.title}),(0,r.jsx)("p",{children:e.desc})]}),(0,r.jsx)("ul",{className:"pgm-grid",children:e.items.map(e=>(0,r.jsxs)("li",{className:"pgm-card",children:[(0,r.jsxs)("div",{className:"pgm-card-head",children:[(0,r.jsx)("span",{className:"pgm-card-ico","aria-hidden":!0,children:e.icon}),(0,r.jsx)("strong",{children:e.label}),(0,r.jsx)("span",{className:"pgm-card-amt pgm-card-amt--plus",children:e.amount})]}),(0,r.jsx)("p",{className:"pgm-card-desc",children:e.detail}),e.cap&&(0,r.jsxs)("span",{className:"pgm-card-cap",children:["\uD83D\uDCCC ",e.cap]})]},e.label))})]},t)),(0,r.jsxs)("section",{className:"pgm-section",children:[(0,r.jsxs)("div",{className:"pgm-section-head",children:[(0,r.jsx)("h3",{children:"⚠ 포인트 차감 규칙"}),(0,r.jsx)("p",{children:"아래 행동 시 포인트가 자동으로 회수되거나 차감됩니다."})]}),(0,r.jsx)("ul",{className:"pgm-grid",children:I.map(e=>(0,r.jsxs)("li",{className:"pgm-card pgm-card--minus",children:[(0,r.jsxs)("div",{className:"pgm-card-head",children:[(0,r.jsx)("span",{className:"pgm-card-ico","aria-hidden":!0,children:e.icon}),(0,r.jsx)("strong",{children:e.label}),(0,r.jsx)("span",{className:"pgm-card-amt pgm-card-amt--minus",children:e.amount})]}),(0,r.jsx)("p",{className:"pgm-card-desc",children:e.detail}),e.cap&&(0,r.jsxs)("span",{className:"pgm-card-cap",children:["\uD83D\uDCCC ",e.cap]})]},e.label))})]}),(0,r.jsxs)("section",{className:"pgm-section",children:[(0,r.jsx)("div",{className:"pgm-section-head",children:(0,r.jsx)("h3",{children:"❓ 자주 묻는 질문"})}),(0,r.jsx)("ul",{className:"pgm-faq",children:R.map((e,t)=>(0,r.jsxs)("li",{className:"pgm-faq-item",children:[(0,r.jsxs)("strong",{children:["Q. ",e.q]}),(0,r.jsxs)("p",{children:["A. ",e.a]})]},t))})]}),(0,r.jsx)("div",{className:"pgm-foot",children:"※ 어뷰징\xb7자동화\xb7중복 활동이 확인되면 포인트가 회수되고 계정 이용이 제한될 수 있습니다."})]})]})}):null}let F=new Set(["enemy71"]);var B=n(99917);let W="ntk:me:v1";function H(e,t){try{sessionStorage.setItem(W,JSON.stringify({value:e,at:t}))}catch{}}let J=function(){try{let e=sessionStorage.getItem(W);if(!e)return null;let t=JSON.parse(e);if(!t||"number"!=typeof t.at||Date.now()-t.at>3e4)return null;return t}catch{return null}}(),q=J?.value??null,G=J?.at??0,U=null,K=new Set;function z(){for(let e of K)try{e()}catch{}}function Q(){q=null,G=0,U=null;try{sessionStorage.removeItem(W)}catch{}P++,S=null,L=null,_=null,g();try{for(let e=sessionStorage.length-1;e>=0;e--){let t=sessionStorage.key(e);t?.startsWith(o)&&sessionStorage.removeItem(t)}}catch{}z()}window.addEventListener("ntk:invalidate-me",Q),window.addEventListener("pageshow",e=>{e.persisted&&Q()});async function X(e=!1){let t=q&&Date.now()-G<3e4;return!e&&t&&q?q:U||(U=fetch("/api/me",{cache:"no-store",credentials:"same-origin"}).then(async e=>e.ok?await e.json():{authenticated:!1}).then(e=>{if(e.blockCheck&&(e.blockCheck,!1===e.blockCheck.blocked))try{localStorage.setItem("ntk_blk_ok",String(Date.now()))}catch{}let t=e.authenticated&&e.user?{authenticated:!0,user:e.user}:{authenticated:!1};return q=t,H(t,G=Date.now()),z(),t}).catch(()=>{let e={authenticated:!1};return q=e,H(e,G=Date.now()),z(),e}).finally(()=>{U=null}))}function V(e){let t=e??(q&&Date.now()-G<3e4?q:null),[n,r]=(0,a.useState)(t);return(0,a.useEffect)(()=>{let t=!1;e?(q=e,H(e,G=Date.now())):q&&Date.now()-G<3e4&&r(q);let n=()=>{t||r(q)};return K.add(n),(!e||!q||Date.now()-G>=3e4)&&X().then(e=>{t||r(e)}),()=>{t=!0,K.delete(n)}},[e]),n}function Y({compact:e=!1,initialMe:t}){let n=V(t);if(!n?.authenticated)return e?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("a",{href:"#login","data-auth-open":"login",className:"m-icon","aria-label":"로그인",title:"로그인",children:[(0,r.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,r.jsx)("title",{children:"로그인"}),(0,r.jsx)("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),(0,r.jsx)("circle",{cx:"12",cy:"7",r:"4"})]}),(0,r.jsx)("span",{className:"sr-only",children:"로그인"})]}),(0,r.jsxs)("a",{href:"#signup","data-auth-open":"signup",className:"m-icon m-icon--brand","aria-label":"회원가입",title:"회원가입",children:[(0,r.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,r.jsx)("title",{children:"회원가입"}),(0,r.jsx)("path",{d:"M19 8v6"}),(0,r.jsx)("path",{d:"M22 11h-6"}),(0,r.jsx)("path",{d:"M14 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),(0,r.jsx)("circle",{cx:"8",cy:"7",r:"4"})]}),(0,r.jsx)("span",{className:"sr-only",children:"회원가입"})]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("a",{href:"#login","data-auth-open":"login",className:"btn btn--ghost desktop-only",children:"로그인"}),(0,r.jsx)("a",{href:"#signup","data-auth-open":"signup",className:"btn btn--primary desktop-only",children:"회원가입"})]});let a=n.user,i=a.extraRoles.length>0?`${a.role}+${a.extraRoles.join("+")}`:a.role;return e?(0,r.jsx)(s,{compact:!0,username:a.username,nickname:a.nickname,role:i,avatarUrl:a.avatarUrl,points:a.points,level:a.level,curInLevel:a.curInLevel,needForLevel:a.needForLevel,ratio:a.ratio,remaining:a.remaining,isAdmin:a.isAdmin,nicknameEffect:a.nicknameEffect}):(0,r.jsx)("span",{className:"desktop-only header-user-row",children:(0,r.jsx)(s,{username:a.username,nickname:a.nickname,role:i,avatarUrl:a.avatarUrl,points:a.points,level:a.level,curInLevel:a.curInLevel,needForLevel:a.needForLevel,ratio:a.ratio,remaining:a.remaining,isAdmin:a.isAdmin,nicknameEffect:a.nicknameEffect})})}function Z({initialMe:e}={}){let t=V(e);return t?.authenticated?(0,r.jsx)($,{enabled:t.user.notificationsEnabled,ownerKey:t.user.id,initialUnreadCount:t.user.notificationUnreadCount??0,compact:!0},t.user.id):null}function ee({active:e,initialMe:t}){let n=V(t);return n?.authenticated&&n.user.isAdmin?(0,r.jsxs)("a",{href:"/todos",className:"todos"===e?"active":"",children:[(0,r.jsx)("span",{className:"nd-ico",children:"\uD83D\uDCCB"}),"수정 요청 TODO"]}):null}function et({active:e,initialMe:t}){let n=V(t);return n?.authenticated&&n.user.isAdmin?(0,r.jsxs)("a",{href:"/test-board",className:"test-board"===e?"active":"",children:[(0,r.jsx)("span",{className:"nd-ico",children:"\uD83E\uDDEA"}),"테스트게시판"]}):null}function en({active:e,initialMe:t}){let n=V(t);return n?.authenticated&&n.user.isManhwaManager?(0,r.jsxs)("a",{href:"/manhwa/failed",className:"manhwa-failed"===e?"active":"",children:[(0,r.jsx)("span",{className:"nd-ico",children:"\uD83D\uDCA5"}),"실패만화 관리"]}):null}function er({children:e,initialMe:t}){let n=V(t);return n?.authenticated&&n.user.isSuperAdmin?null:(0,r.jsx)(r.Fragment,{children:e})}function ea({children:e}){let t=V();return null!==t&&t.authenticated&&t.user.isAdmin?(0,r.jsx)(r.Fragment,{children:e}):null}let ei={devToolsBlockerEnabled:!1,linkPrefetchEnabled:!1,novelPayoutPct:30},es=null,el=0,ec=null,eo=new Set;function eu(e,t=Date.now()){for(let n of(es=e,el=t,eo))try{n()}catch{}}async function ed(e=!1){let t=es&&Date.now()-el<6e4;return!e&&t&&es?es:ec||(ec=fetch("/api/layout-settings").then(async e=>e.ok?await e.json():ei).then(e=>(eu(e),e)).catch(()=>(eu(ei),ei)).finally(()=>{ec=null}))}let em=(0,a.createContext)(null);function eh(){return(0,a.useContext)(em)}function ef({initialSettings:e,children:t}){let n=e??(es&&Date.now()-el<6e4?es:null),[i,s]=(0,a.useState)(n);return(0,a.useEffect)(()=>{let t=!1;e?(eu(e),s(e)):es&&Date.now()-el<6e4&&s(es);let n=()=>{t||s(es)};return eo.add(n),!e&&(!es||Date.now()-el>=6e4)&&ed().then(e=>{t||s(e)}),()=>{t=!0,eo.delete(n)}},[e]),(0,r.jsx)(em.Provider,{value:i,children:t})}function ep(){let e=eh(),t=e?.novelPayoutPct??30;return(0,r.jsx)(O,{novelPayoutPct:t})}function ex({children:e,initialSettings:t}){return(0,r.jsx)(ef,{initialSettings:t,children:(0,r.jsx)(ej,{children:e})})}function ej({children:e}){let t=eh();return(0,r.jsx)(B.p,{value:t?.linkPrefetchEnabled??!1,children:e})}function ev({children:e}){var t;let n=V(),a=eh();return null===n||null===a||!a.devToolsBlockerEnabled||n.authenticated&&n.user.isAdmin?null:n.authenticated&&(t=n.user.username)&&F.has(t)?null:(0,r.jsx)(r.Fragment,{children:e})}},77238:(e,t,n)=>{n.d(t,{D:()=>u});var r=n(95155),a=n(98500),i=n.n(a),s=n(12115),l=n(99917);function c(e){if("string"==typeof e)return e;if(e&&"object"==typeof e&&"pathname"in e){let t=e.query,n=t?`?${new URLSearchParams(Object.entries(t).reduce((e,[t,n])=>(null!=n&&(e[t]=String(n)),e),{})).toString()}`:"";return(e.pathname??"")+n}return"#"}function o(e){if(!e.startsWith("/")||e.startsWith("//")||e.includes("\\"))return!1;for(let t of e){let e=t.charCodeAt(0);if(e<32||127===e)return!1}return!0}let u=(0,s.forwardRef)(function({prefetch:e,href:t,replace:n,scroll:a,shallow:s,locale:u,as:d,...m},h){let f=(0,l.y)(),p=c(t),x=d?c(d):void 0;return o(p)&&(!x||o(x))?(0,r.jsx)(i(),{...m,ref:h,href:p,replace:n,scroll:a,shallow:s,locale:u,as:x,prefetch:e??f}):(0,r.jsx)("a",{...m,ref:h,href:function(e){if(e.includes("\\")||e.startsWith("//"))return"#";for(let t of e){let e=t.charCodeAt(0);if(e<32||127===e)return"#"}let t=e.trimStart().toLowerCase();return t.startsWith("javascript:")||t.startsWith("data:")||t.startsWith("vbscript:")?"#":e}(p)})})},99917:(e,t,n)=>{n.d(t,{p:()=>s,y:()=>l});var r=n(95155),a=n(12115);let i=(0,a.createContext)(!1);function s({value:e,children:t}){return(0,r.jsx)(i.Provider,{value:e,children:t})}function l(){return(0,a.useContext)(i)}}}]);